﻿import QtQuick 2.0

import "../components"
// 已弃用
Item {

    id: root

    property int curIdx: Math.floor(animation.wheelPosi) >= 9 ? animation.wheelPosi-9 : animation.wheelPosi
    property var bottleName: ["产物瓶1","产物瓶2","产物瓶3","产物瓶4","产物瓶5","产物瓶6","产物瓶7","产物瓶8","产物瓶9"]

    property bool editable: true
    function startAnimation(){
        animation.startAnimation()
    }

    WheelCanvas{
        id: animation
    }

    Text{
        visible: showDetails
        x: 30*dp; y: 30*dp
        height: 20*dp; width: 120*dp
        font.pixelSize: config.fontsize + 5*dp
        text: "转盘"
        font.bold: true
    }

    Rectangle{
        radius: 3*dp
        color: Qt.rgba(224/255, 195/255, 135/255, 1)
        x: 30*dp; y: root.height - 95*dp
        height: 66*dp; width: 94*dp
        Item{
            x: 2*dp;  y: 2*dp
            height: 30*dp;  width: 90*dp
            Text{
                text: "转盘转动"
                anchors.centerIn: parent
                font.pixelSize: config.fontsize
            }
        }CustomComboButton{
            editable: root.editable
            x: 2*dp;  y: 32*dp
            height: 32*dp;  width: 90*dp
            popupSignalItemHeight: 30*dp
            listItemHeight: 30*dp
            comboBgColor: Qt.rgba(233/255, 230/255, 224/255, 1)
            title: "方向"
            model: ["顺时针", "逆时针", "复位"]
            onTextClicked: {
                if(text === "顺时针"){
                    CAnimation.turnWheel(-1, 1)
                    CommunicationMethod.turntableRotates(1)
                }else if(text === "逆时针"){
                    CAnimation.turnWheel(1, 1)
                    CommunicationMethod.turntableRotates(0)
                }else if(text === "复位"){
                    CAnimation.turnWheel_posi(0, 1)
                    CommunicationMethod.turntableRotates(1)
                }
            }
        }
    }

    Rectangle{
        y: root.height - 80*dp
        height: 46*dp; width: 210*dp
        radius: 3*dp
        color: Qt.rgba(224/255, 195/255, 135/255, 1)
        anchors.horizontalCenter: parent.horizontalCenter
        Text{
            anchors.centerIn: parent
            font.pixelSize: config.fontsize + 2
            text: "当前位置: " + (curIdx+1).toString() + "  (" + bottleName[curIdx] + ")"
        }
    }


}
